package tests;

import main.Core;
import model.ImageSprite;
import scene.BaseScene;
import data.Vector2;

public class MultiSpriteTest extends BaseScene {

	ImageSprite parent;
	public MultiSpriteTest(Core core) {
		super(core);
		parent = new ImageSprite("images/Bulbasaur.png", new Vector2(50,50), new Vector2(250), Vector2.zero(), this, core);
		ImageSprite childA = new ImageSprite("images/Bulbasaur.png", new Vector2(100,50), new Vector2(50), Vector2.zero(), parent, core);
		ImageSprite childB = new ImageSprite("images/Charmander.png", new Vector2(50,100), new Vector2(125), Vector2.zero(), parent, core);
		ImageSprite grandChildA = new ImageSprite("images/squirtle.gif", new Vector2(130,110), new Vector2(50), Vector2.zero(), childB, core);
		
		ImageSprite obstacle = new ImageSprite("images/squirtle.gif", new Vector2(500), new Vector2(120), Vector2.zero(), this, core);
		obstacle.setDepth(4f);
		// test how the sprites will propagate changes that they receive, to their childreen.
		// example, i move parent 50pixels horizontally, so it needs to do this to all it's children.
		
		//parent.setSpeed(new Vector2(50));
		
		//parent.setPosition(new Vector2(300, 500));
		
		//parent.setSize(new Vector2(350));
		
		//parent.setScale(new Vector2(0.2f));
		
		parent.setDepth(0f);
		childA.setDepth(1f);
		childB.setDepth(1f);
		grandChildA.setDepth(2f);
	}

	@Override
	public void update(float elapsedTime) {
		super.update(elapsedTime);
		parent.setScale(Vector2.add(parent.getScale(), new Vector2(0.01f)));
		parent.setDepth(parent.getDepth() + 0.02f); // at some point, the sprite's depth will pass the obstacle's depth
	}
}
